<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>覆盖延伸-修改项目</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
</head>
	<link rel="stylesheet" type="text/css" href="${ ctx }/js/ext-3.0.3/resources/css/ext-all.css">
	<link rel="stylesheet" type="text/css" href="${ctx}/js/ext-3.0.3/extension/css/combos.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/js/ext-3.0.3/extension/css/RowEditor.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/css/ext-patch.css" />
	<script type="text/javascript" src="${ctx}/js/ext-3.0.3/adapter/ext/ext-base.js" charset="UTF-8"></script>
	<script type="text/javascript" src="${ctx}/js/ext-3.0.3/ext-all-debug.js" charset="UTF-8"></script>
	<script type="text/javascript" src="${ctx}/js/ext-3.0.3/source/locale/ext-lang-zh_CN.js" charset="UTF-8"></script>
		<script type="text/javascript" src="${ctx }/js/ext-3.0.3/ux/LovCombo.js"></script>
	<script type="text/javascript" src="${ctx}/scripts/hxcy/room/UpdateProject.js" charset="UTF-8"></script>
	<script type="text/javascript" src="${ctx}/scripts/hxcy/room/ComplaintWindow.js" charset="UTF-8"></script>
	<script type="text/javascript" src="${ctx}/js/extutil/PopupManager.js"></script>
	<script type="text/javascript" src="${ctx}/js/extutil/StoreManager.js"></script>
	<script type="text/javascript" src="${ctx}/js/extutil/PopupField.js"></script>

<style>
#basic td {
    padding-left: 15px;
}
.formTable input[type='text'] {
    background: #FFFFFF url(../../js/ext-3.0.3/resources/images/default/form/text-bg.gif) repeat-x scroll 0 0;
    border: 1px solid #B5B8C8;
    height: 18px;
    width: 170px;
    padding: 2px 3px 0;
    font-family: arial,helvetica,sans-serif;
}
.odd-row {
    height: 21px;
    vertical-align: bottom;
}
.bottom-row {
    height: 50px;
    vertical-align: middle;
}
#date-span {
    color: green;
    font-family: Consolas;
    font-size: 15px;
    font-weight: bold;
}
#time-span {
    color: red;
    font-family: Consolas;
    font-size: 17px;
    font-weight: bold;
    margin-left: 15px;
}
#freights {
    border-collapse: collapse;
}

#freights tr {
    height: 28px;
}

#freights td {
    text-align: left;
    padding-left: 10px;
    padding-right: 10px;
}
.popupBtn {
    cursor: pointer;  
}
.nodisplay {
    display: none;
}
.formlabel {
    padding-left: 5px;
}
.formfield {
    padding-right: 5px;
}
.silk-add { 
    background-image: url('${ctx}/images/add.gif') !important; 
    background-repeat: no-repeat; 
}
.silk-update { 
    background-image: url('${ctx}/images/edit.gif') !important;
    background-repeat: no-repeat; 
}
.silk-delete { 
    background-image: url('${ctx}/images/delete.gif') !important; 
    background-repeat: no-repeat; 
}
.ext-el-mask {
    /* natural zone popup z-index=100 which is shielded by disabled div mask(soiPanel) */
    z-index:1;
}
</style>

<script type="text/javascript"><!--
var projectId = "<s:property value='roomProject.id'/>";
var taskId= "<s:property value='taskId'/>";
var roomProject;
Ext.BLANK_IMAGE_URL = "${ctx}/js/ext-3.0.3/resources/images/default/s.gif";
Ext.Msg.buttonText.yes = "是";
Ext.Msg.buttonText.no = "否";
Ext.Msg.buttonText.ok = "确定";
Ext.Msg.buttonText.cancel = "取消";

Ext.onReady(function() {
	Ext.QuickTips.init();
    var panel = new SimpleProjectPanel();
    panel.applyToMarkup("content");
    fillInProjectInfo();
});



function fillInProjectInfo() {
	var mask = new Ext.LoadMask(Ext.getBody(), {
        msg : "数据正在加载中，请稍等..."
    });

	mask.show();
	Ext.Ajax.request({
        url: "../popup/extjs/RoomProjectUpdateJson.action",
        params: {
			projectId: projectId,
			taskId:taskId
		},
        scope: this,
        success: function(response, options) {
            var data = Ext.util.JSON.decode(response.responseText);
            roomProject = data.roomProject;
            taskId = data.taskId;
            fillProjectInfo(data.roomProject);
            fillComplaintInfo(data.complaintRecords);
            mask.hide();
        },
        failure: function() {
        	Ext.Msg.alert("提示", "订单加载失败");
            mask.hide();
        }
    });

}

function fillProjectInfo(roomProject) {
    var formData = {
    	"taskId": taskId,
    	"id": roomProject.id,
        "roomProject.id": roomProject.id,
        "roomProject.bizNumber": roomProject.bizNumber,
        "roomProject.area.id": roomProject.area ? roomProject.area.id : "",
               
   		"roomProject.name": roomProject.name,
   		"roomProject.address": roomProject.address,
   		"roomProject.telphone": roomProject.telphone,
   		"roomProject.lon": roomProject.lon,
   		"roomProject.lat": roomProject.lat,
   	
   		"roomProject.newCreate": roomProject.newCreate,
   		"roomProject.relatedCode": roomProject.relatedCode,
   		"roomProject.siteName": roomProject.siteName,
   	 
   		"roomProject.mainSignal": roomProject.mainSignal,
   		"roomProject.liftSignal": roomProject.liftSignal,
   		"roomProject.liftNumber": roomProject.liftNumber,
   		"roomProject.liftTopFloor": roomProject.liftTopFloor,
   		
   		"roomProject.underParkSignal": roomProject.underParkSignal,
   		"roomProject.underParkNumber": roomProject.underParkNumber,
   		"roomProject.underParkCarNumber": roomProject.underParkCarNumber,
   		"roomProject.resolveMethod": roomProject.resolveMethod,
   		"roomProject.coverArea": roomProject.coverArea,
   		
   		"roomProject.emergencyLevel": roomProject.emergencyLevel,
   		"roomProject.remark": roomProject.remark,
   		
   		"roomProject.resolveContent": roomProject.resolveContent,
   		
   		"roomProject.areaType.id": roomProject.areaType.id,
		"roomProject.projectType.id": roomProject.projectType.id,
		"roomProject.gsmBuildType": roomProject.gsmBuildType,
		"roomProject.tdBuildType": roomProject.tdBuildType,   
		"roomProject.lteBuildType": roomProject.lteBuildType,
		"roomProject.wlanBuildType": roomProject.wlanBuildType,
		"roomProject.gsmTerm": roomProject.gsmTerm,
		"roomProject.tdTerm": roomProject.tdTerm,
		"roomProject.lteTerm": roomProject.lteTerm,
		"roomProject.wlanTerm": roomProject.wlanTerm
		
    }
    Ext.getCmp("orderPanel").getForm().setValues(formData);
	
	var areaCombo = Ext.getCmp('areaCombo').store;
	areaCombo.on('load', function(){
	    Ext.getCmp('areaCombo').setValue( roomProject.area.title );
	});
	areaCombo.reload();
	
	if(roomProject.newCreate=='是'){
		Ext.getCmp('relatedcode').setVisible(false);
	}else{
		Ext.getCmp('relatedcode').setVisible(true);
	}
	if(roomProject.netType.indexOf(',')!=-1){
		if(roomProject.netType.indexOf('GSM')!=-1){
			Ext.getCmp('wlan').disable();
			Ext.getCmp('gsm').setValue(true);//这句话很重要(选中状态不破坏check事件)
			//Ext.getCmp('gsm').el.dom.checked=true;//渲染后check事件被破坏
			Ext.getCmp('gsmTerm').enable();
			Ext.getCmp('gsmBuild').enable();
		}
		if(roomProject.netType.indexOf('TD')!=-1){
			Ext.getCmp('wlan').disable();
			Ext.getCmp('td').setValue(true);
			Ext.getCmp('tdTerm').enable();
			Ext.getCmp('tdBuild').enable();
		}
		if(roomProject.netType.indexOf('LTE')!=-1){
			Ext.getCmp('wlan').disable();
			Ext.getCmp('lte').setValue(true);
			Ext.getCmp('lteTerm').enable();
			Ext.getCmp('lteBuild').enable();
		}
	}else{
		
		if(roomProject.netType.indexOf('GSM')==0 || roomProject.netType.indexOf('TD')==0 
				|| roomProject.netType.indexOf('LTE')==0){
			Ext.getCmp('wlan').disable();
		}
		if(roomProject.netType.indexOf('WLAN')==0){
			Ext.getCmp('gsm').disable();
			Ext.getCmp('td').disable();
			Ext.getCmp('lte').disable();
			
		}
		Ext.getCmp(roomProject.netType.toLowerCase()).setValue(true);
		Ext.getCmp(roomProject.netType.toLowerCase()+'Term').enable();
		Ext.getCmp(roomProject.netType.toLowerCase()+'Build').enable();
		
	}
 }

function fillComplaintInfo(complaints) {
	var dataStore = Ext.getCmp("complaintPanel").dataStore;
    for (var i = 0; i < complaints.length; i++) {
        var e = new dataStore.recordType({
            id: complaints[i].id,
            woId: complaints[i].woId,
            dealTime: complaints[i].dealTime,
            customerName: complaints[i].customerName,
            customerMobile: complaints[i].customerMobile,
            complaintContent: complaints[i].complaintContent,
            address: complaints[i].address,
            reason: complaints[i].reason,
            longitude: complaints[i].longitude,
            latitude: complaints[i].latitude,
            resolve: complaints[i].resolve,
            imepId:complaints[i].imepId
           
        });
        var count = dataStore.getCount();
        dataStore.insert(count, e);
    }
}
--></script>

<div id="content">

</div>